{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2779\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "order_id\n",
       "137      6\n",
       "165     18\n",
       "166      5\n",
       "171      7\n",
       "177      4\n",
       "        ..\n",
       "1309    13\n",
       "1314    12\n",
       "1317    18\n",
       "1319     9\n",
       "1323    15\n",
       "Length: 278, dtype: int64"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pandas as pd\n",
    "import numpy as np\n",
    "detail = pd.read_excel('meal_order_detail.xlsx' ,sep=',',encoding='gbk')\n",
    "print(len(detail))\n",
    "detailGroup=detail[['order_id','counts','amounts']].groupby(by='order_id')\n",
    "detailGroup.max()\n",
    "detailGroup.size()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>detail_id</th>\n",
       "      <th>order_id</th>\n",
       "      <th>dishes_id</th>\n",
       "      <th>logicprn_name</th>\n",
       "      <th>parent_class_name</th>\n",
       "      <th>dishes_name</th>\n",
       "      <th>itemis_add</th>\n",
       "      <th>counts</th>\n",
       "      <th>amounts</th>\n",
       "      <th>cost</th>\n",
       "      <th>place_order_time</th>\n",
       "      <th>discount_amt</th>\n",
       "      <th>discount_reason</th>\n",
       "      <th>kick_back</th>\n",
       "      <th>add_inprice</th>\n",
       "      <th>add_info</th>\n",
       "      <th>bar_code</th>\n",
       "      <th>picture_file</th>\n",
       "      <th>emp_id</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2956</td>\n",
       "      <td>417</td>\n",
       "      <td>610062</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>蒜蓉生蚝</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>49</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2016-08-01 11:05:36</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>caipu/104001.jpg</td>\n",
       "      <td>1442</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2958</td>\n",
       "      <td>417</td>\n",
       "      <td>609957</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>蒙古烤羊腿\\r\\n\\r\\n\\r\\n</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>48</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2016-08-01 11:07:07</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>caipu/202003.jpg</td>\n",
       "      <td>1442</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2961</td>\n",
       "      <td>417</td>\n",
       "      <td>609950</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>大蒜苋菜</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>30</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2016-08-01 11:07:40</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>caipu/303001.jpg</td>\n",
       "      <td>1442</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2966</td>\n",
       "      <td>417</td>\n",
       "      <td>610038</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>芝麻烤紫菜</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>25</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2016-08-01 11:11:11</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>caipu/105002.jpg</td>\n",
       "      <td>1442</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2968</td>\n",
       "      <td>417</td>\n",
       "      <td>610003</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>蒜香包</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>13</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2016-08-01 11:11:30</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>caipu/503002.jpg</td>\n",
       "      <td>1442</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2774</th>\n",
       "      <td>6750</td>\n",
       "      <td>774</td>\n",
       "      <td>610011</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>白饭/大碗</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>10</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2016-08-10 21:56:24</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>caipu/601005.jpg</td>\n",
       "      <td>1138</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2775</th>\n",
       "      <td>6742</td>\n",
       "      <td>774</td>\n",
       "      <td>609996</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>牛尾汤</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>40</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2016-08-10 21:56:48</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>caipu/201006.jpg</td>\n",
       "      <td>1138</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2776</th>\n",
       "      <td>6756</td>\n",
       "      <td>774</td>\n",
       "      <td>609949</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>意文柠檬汁</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>13</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2016-08-10 22:01:52</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>caipu/404005.jpg</td>\n",
       "      <td>1138</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2777</th>\n",
       "      <td>6763</td>\n",
       "      <td>774</td>\n",
       "      <td>610014</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>金玉良缘</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>30</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2016-08-10 22:03:58</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>caipu/302003.jpg</td>\n",
       "      <td>1138</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2778</th>\n",
       "      <td>6764</td>\n",
       "      <td>774</td>\n",
       "      <td>610017</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>酸辣藕丁</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>33</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2016-08-10 22:04:30</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>caipu/302006.jpg</td>\n",
       "      <td>1138</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>2779 rows × 19 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      detail_id  order_id  dishes_id  logicprn_name  parent_class_name  \\\n",
       "0          2956       417     610062            NaN                NaN   \n",
       "1          2958       417     609957            NaN                NaN   \n",
       "2          2961       417     609950            NaN                NaN   \n",
       "3          2966       417     610038            NaN                NaN   \n",
       "4          2968       417     610003            NaN                NaN   \n",
       "...         ...       ...        ...            ...                ...   \n",
       "2774       6750       774     610011            NaN                NaN   \n",
       "2775       6742       774     609996            NaN                NaN   \n",
       "2776       6756       774     609949            NaN                NaN   \n",
       "2777       6763       774     610014            NaN                NaN   \n",
       "2778       6764       774     610017            NaN                NaN   \n",
       "\n",
       "            dishes_name  itemis_add  counts  amounts  cost  \\\n",
       "0                  蒜蓉生蚝           0       1       49   NaN   \n",
       "1     蒙古烤羊腿\\r\\n\\r\\n\\r\\n           0       1       48   NaN   \n",
       "2                  大蒜苋菜           0       1       30   NaN   \n",
       "3                 芝麻烤紫菜           0       1       25   NaN   \n",
       "4                   蒜香包           0       1       13   NaN   \n",
       "...                 ...         ...     ...      ...   ...   \n",
       "2774              白饭/大碗           0       1       10   NaN   \n",
       "2775                牛尾汤           0       1       40   NaN   \n",
       "2776             意文柠檬汁            0       1       13   NaN   \n",
       "2777               金玉良缘           0       1       30   NaN   \n",
       "2778               酸辣藕丁           0       1       33   NaN   \n",
       "\n",
       "        place_order_time  discount_amt  discount_reason  kick_back  \\\n",
       "0    2016-08-01 11:05:36           NaN              NaN        NaN   \n",
       "1    2016-08-01 11:07:07           NaN              NaN        NaN   \n",
       "2    2016-08-01 11:07:40           NaN              NaN        NaN   \n",
       "3    2016-08-01 11:11:11           NaN              NaN        NaN   \n",
       "4    2016-08-01 11:11:30           NaN              NaN        NaN   \n",
       "...                  ...           ...              ...        ...   \n",
       "2774 2016-08-10 21:56:24           NaN              NaN        NaN   \n",
       "2775 2016-08-10 21:56:48           NaN              NaN        NaN   \n",
       "2776 2016-08-10 22:01:52           NaN              NaN        NaN   \n",
       "2777 2016-08-10 22:03:58           NaN              NaN        NaN   \n",
       "2778 2016-08-10 22:04:30           NaN              NaN        NaN   \n",
       "\n",
       "      add_inprice  add_info  bar_code      picture_file  emp_id  \n",
       "0               0       NaN       NaN  caipu/104001.jpg    1442  \n",
       "1               0       NaN       NaN  caipu/202003.jpg    1442  \n",
       "2               0       NaN       NaN  caipu/303001.jpg    1442  \n",
       "3               0       NaN       NaN  caipu/105002.jpg    1442  \n",
       "4               0       NaN       NaN  caipu/503002.jpg    1442  \n",
       "...           ...       ...       ...               ...     ...  \n",
       "2774            0       NaN       NaN  caipu/601005.jpg    1138  \n",
       "2775            0       NaN       NaN  caipu/201006.jpg    1138  \n",
       "2776            0       NaN       NaN  caipu/404005.jpg    1138  \n",
       "2777            0       NaN       NaN  caipu/302003.jpg    1138  \n",
       "2778            0       NaN       NaN  caipu/302006.jpg    1138  \n",
       "\n",
       "[2779 rows x 19 columns]"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "detail"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>counts</th>\n",
       "      <th>amounts</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>sum</th>\n",
       "      <td>3088.000000</td>\n",
       "      <td>125992.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mean</th>\n",
       "      <td>1.111191</td>\n",
       "      <td>45.337172</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "           counts        amounts\n",
       "sum   3088.000000  125992.000000\n",
       "mean     1.111191      45.337172"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "detail[['counts','amounts']].aggregate([np.sum,np.mean])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>counts</th>\n",
       "      <th>amounts</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>sum</th>\n",
       "      <td>3088.000000</td>\n",
       "      <td>125992.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mean</th>\n",
       "      <td>1.111191</td>\n",
       "      <td>45.337172</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "           counts        amounts\n",
       "sum   3088.000000  125992.000000\n",
       "mean     1.111191      45.337172"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "detail[['counts','amounts']].agg([np.sum,np.mean])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "counts      1.111191\n",
       "amounts    45.337172\n",
       "dtype: float64"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "detail[['counts','amounts']].apply(np.mean)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>counts</th>\n",
       "      <th>amounts</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>order_id</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>137</th>\n",
       "      <td>9</td>\n",
       "      <td>194</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>165</th>\n",
       "      <td>21</td>\n",
       "      <td>953</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>166</th>\n",
       "      <td>7</td>\n",
       "      <td>241</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>171</th>\n",
       "      <td>10</td>\n",
       "      <td>254</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>177</th>\n",
       "      <td>4</td>\n",
       "      <td>137</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "          counts  amounts\n",
       "order_id                 \n",
       "137            9      194\n",
       "165           21      953\n",
       "166            7      241\n",
       "171           10      254\n",
       "177            4      137"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "detailGroup.apply(np.sum).head(5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>counts</th>\n",
       "      <th>amounts</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>order_id</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>137</th>\n",
       "      <td>9</td>\n",
       "      <td>194</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>165</th>\n",
       "      <td>21</td>\n",
       "      <td>953</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>166</th>\n",
       "      <td>7</td>\n",
       "      <td>241</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>171</th>\n",
       "      <td>10</td>\n",
       "      <td>254</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>177</th>\n",
       "      <td>4</td>\n",
       "      <td>137</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>540</th>\n",
       "      <td>6</td>\n",
       "      <td>143</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>541</th>\n",
       "      <td>7</td>\n",
       "      <td>189</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>545</th>\n",
       "      <td>9</td>\n",
       "      <td>240</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>546</th>\n",
       "      <td>21</td>\n",
       "      <td>832</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>547</th>\n",
       "      <td>16</td>\n",
       "      <td>491</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>100 rows × 2 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "          counts  amounts\n",
       "order_id                 \n",
       "137            9      194\n",
       "165           21      953\n",
       "166            7      241\n",
       "171           10      254\n",
       "177            4      137\n",
       "...          ...      ...\n",
       "540            6      143\n",
       "541            7      189\n",
       "545            9      240\n",
       "546           21      832\n",
       "547           16      491\n",
       "\n",
       "[100 rows x 2 columns]"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "detailGroup.apply(np.sum).head(100)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>amounts</th>\n",
       "      <th>counts</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>order_id</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>137</th>\n",
       "      <td>32.333333</td>\n",
       "      <td>1.500000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>165</th>\n",
       "      <td>52.944444</td>\n",
       "      <td>1.166667</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>166</th>\n",
       "      <td>48.200000</td>\n",
       "      <td>1.400000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>171</th>\n",
       "      <td>36.285714</td>\n",
       "      <td>1.428571</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>177</th>\n",
       "      <td>34.250000</td>\n",
       "      <td>1.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1309</th>\n",
       "      <td>34.076923</td>\n",
       "      <td>1.153846</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1314</th>\n",
       "      <td>42.333333</td>\n",
       "      <td>1.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1317</th>\n",
       "      <td>67.222222</td>\n",
       "      <td>1.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1319</th>\n",
       "      <td>67.777778</td>\n",
       "      <td>1.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1323</th>\n",
       "      <td>50.933333</td>\n",
       "      <td>1.000000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>278 rows × 2 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "            amounts    counts\n",
       "order_id                     \n",
       "137       32.333333  1.500000\n",
       "165       52.944444  1.166667\n",
       "166       48.200000  1.400000\n",
       "171       36.285714  1.428571\n",
       "177       34.250000  1.000000\n",
       "...             ...       ...\n",
       "1309      34.076923  1.153846\n",
       "1314      42.333333  1.000000\n",
       "1317      67.222222  1.000000\n",
       "1319      67.777778  1.000000\n",
       "1323      50.933333  1.000000\n",
       "\n",
       "[278 rows x 2 columns]"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.pivot_table(detail[['order_id','counts','amounts']],index='order_id')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>amounts</th>\n",
       "      <th>counts</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>order_id</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>137</th>\n",
       "      <td>194</td>\n",
       "      <td>9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>165</th>\n",
       "      <td>953</td>\n",
       "      <td>21</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>166</th>\n",
       "      <td>241</td>\n",
       "      <td>7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>171</th>\n",
       "      <td>254</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>177</th>\n",
       "      <td>137</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1309</th>\n",
       "      <td>443</td>\n",
       "      <td>15</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1314</th>\n",
       "      <td>508</td>\n",
       "      <td>12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1317</th>\n",
       "      <td>1210</td>\n",
       "      <td>18</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1319</th>\n",
       "      <td>610</td>\n",
       "      <td>9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1323</th>\n",
       "      <td>764</td>\n",
       "      <td>15</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>278 rows × 2 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "          amounts  counts\n",
       "order_id                 \n",
       "137           194       9\n",
       "165           953      21\n",
       "166           241       7\n",
       "171           254      10\n",
       "177           137       4\n",
       "...           ...     ...\n",
       "1309          443      15\n",
       "1314          508      12\n",
       "1317         1210      18\n",
       "1319          610       9\n",
       "1323          764      15\n",
       "\n",
       "[278 rows x 2 columns]"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.pivot_table(detail[['order_id','counts','amounts']],index='order_id',aggfunc=np.sum)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead tr th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe thead tr:last-of-type th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr>\n",
       "      <th></th>\n",
       "      <th colspan=\"10\" halign=\"left\">amounts</th>\n",
       "      <th>...</th>\n",
       "      <th colspan=\"10\" halign=\"left\">counts</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dishes_name</th>\n",
       "      <th>42度海之蓝</th>\n",
       "      <th>北冰洋汽水</th>\n",
       "      <th>38度剑南春</th>\n",
       "      <th>50度古井贡酒</th>\n",
       "      <th>52度泸州老窖</th>\n",
       "      <th>53度茅台</th>\n",
       "      <th>一品香酥藕</th>\n",
       "      <th>三丝鳝鱼</th>\n",
       "      <th>三色凉拌手撕兔</th>\n",
       "      <th>不加一滴油的酸奶蛋糕</th>\n",
       "      <th>...</th>\n",
       "      <th>香辣腐乳炒虾</th>\n",
       "      <th>香酥两吃大虾</th>\n",
       "      <th>鱼香肉丝拌面</th>\n",
       "      <th>鲜美鳝鱼</th>\n",
       "      <th>鸡蛋、肉末肠粉</th>\n",
       "      <th>麻辣小龙虾</th>\n",
       "      <th>黄尾袋鼠西拉子红葡萄酒</th>\n",
       "      <th>黄油曲奇饼干</th>\n",
       "      <th>黄花菜炒木耳</th>\n",
       "      <th>黑米恋上葡萄</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>order_id</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>137</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>165</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>80.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>10.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1.0</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>166</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>171</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>177</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1309</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>10.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1314</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>80.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>1.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1317</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>128.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1319</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1323</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>80.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>278 rows × 308 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "            amounts                                                     \\\n",
       "dishes_name  42度海之蓝  北冰洋汽水  38度剑南春  50度古井贡酒 52度泸州老窖   53度茅台 一品香酥藕 三丝鳝鱼   \n",
       "order_id                                                                 \n",
       "137             NaN     NaN     NaN     NaN      NaN    NaN   NaN  NaN   \n",
       "165             NaN     NaN    80.0     NaN      NaN    NaN  10.0  NaN   \n",
       "166             NaN     NaN     NaN     NaN      NaN    NaN   NaN  NaN   \n",
       "171             NaN     NaN     NaN     NaN      NaN    NaN   NaN  NaN   \n",
       "177             NaN     NaN     NaN     NaN      NaN    NaN   NaN  NaN   \n",
       "...             ...     ...     ...     ...      ...    ...   ...  ...   \n",
       "1309            NaN     NaN     NaN     NaN      NaN    NaN  10.0  NaN   \n",
       "1314            NaN     NaN    80.0     NaN      NaN    NaN   NaN  NaN   \n",
       "1317            NaN     NaN     NaN     NaN      NaN  128.0   NaN  NaN   \n",
       "1319            NaN     NaN     NaN     NaN      NaN    NaN   NaN  NaN   \n",
       "1323            NaN     NaN    80.0     NaN      NaN    NaN   NaN  NaN   \n",
       "\n",
       "                                ... counts                                   \\\n",
       "dishes_name 三色凉拌手撕兔 不加一滴油的酸奶蛋糕  ... 香辣腐乳炒虾 香酥两吃大虾 鱼香肉丝拌面 鲜美鳝鱼 鸡蛋、肉末肠粉 麻辣小龙虾   \n",
       "order_id                        ...                                           \n",
       "137             NaN        NaN  ...    NaN    NaN    NaN  NaN     NaN   1.0   \n",
       "165             NaN        NaN  ...    NaN    NaN    NaN  NaN     NaN   NaN   \n",
       "166             NaN        NaN  ...    NaN    NaN    NaN  NaN     NaN   NaN   \n",
       "171             NaN        NaN  ...    NaN    NaN    NaN  NaN     NaN   NaN   \n",
       "177             NaN        NaN  ...    NaN    NaN    NaN  NaN     NaN   NaN   \n",
       "...             ...        ...  ...    ...    ...    ...  ...     ...   ...   \n",
       "1309            NaN        NaN  ...    NaN    NaN    1.0  NaN     NaN   NaN   \n",
       "1314            NaN        NaN  ...    1.0    NaN    NaN  NaN     NaN   NaN   \n",
       "1317            NaN        NaN  ...    NaN    NaN    NaN  NaN     NaN   NaN   \n",
       "1319            NaN        NaN  ...    NaN    NaN    NaN  NaN     NaN   1.0   \n",
       "1323            NaN        NaN  ...    NaN    NaN    NaN  NaN     NaN   NaN   \n",
       "\n",
       "                                              \n",
       "dishes_name 黄尾袋鼠西拉子红葡萄酒 黄油曲奇饼干 黄花菜炒木耳 黑米恋上葡萄  \n",
       "order_id                                      \n",
       "137                 NaN    NaN    NaN    NaN  \n",
       "165                 NaN    NaN    1.0    NaN  \n",
       "166                 NaN    NaN    NaN    NaN  \n",
       "171                 NaN    NaN    NaN    NaN  \n",
       "177                 NaN    NaN    NaN    NaN  \n",
       "...                 ...    ...    ...    ...  \n",
       "1309                1.0    NaN    NaN    NaN  \n",
       "1314                NaN    NaN    NaN    NaN  \n",
       "1317                NaN    NaN    NaN    NaN  \n",
       "1319                NaN    NaN    NaN    NaN  \n",
       "1323                NaN    NaN    NaN    NaN  \n",
       "\n",
       "[278 rows x 308 columns]"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.pivot_table(detail[['order_id','dishes_name','counts','amounts']],index='order_id',columns='dishes_name',aggfunc=np.sum)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>dishes_name</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>order_id</th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>137</th>\n",
       "      <td>西瓜胡萝卜沙拉麻辣小龙虾农夫山泉NFC果汁100%橙汁番茄炖牛腩\\r\\n白饭/小碗凉拌菠菜</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>165</th>\n",
       "      <td>芝士烩波士顿龙虾清蒸海鱼百里香奶油烤紅酒牛肉辣炒鱿鱼爆炒猪肝啤酒鸭干锅田鸡番茄蛋汤黄花菜炒木...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>166</th>\n",
       "      <td>水煮鱼葱姜炒蟹啤酒鸭百威啤酒罐装大理石奶油蛋糕</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>171</th>\n",
       "      <td>油焖麻辣虾蒜香辣花甲蒜蓉生蚝番茄有机花菜谷稻小庄 白饭/大碗冰糖红豆薏米粥</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>177</th>\n",
       "      <td>蒜香辣花甲桂圆枸杞鸽子汤照烧鸡腿\\r\\n青炒扁豆</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1309</th>\n",
       "      <td>花蛤蒸蛋芹黄鳝丝玉竹南北杏鸭腿汤番茄有机花菜五彩藕苗孜然羊排谷稻小庄 黄尾袋鼠西拉子红葡萄酒...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1314</th>\n",
       "      <td>香辣腐乳炒虾盘蟹蒸蛋清蒸蝶鱼党参黄芪炖牛尾\\r\\n\\r\\n\\r\\n牛尾汤爆炒双丝独家薄荷鲜虾...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1317</th>\n",
       "      <td>芝士烩波士顿龙虾倒立蒸梭子蟹清蒸海鱼蒜蓉生蚝快炒黄鳝培根紫菜卷番茄炖牛腩\\r\\n\\r\\n\\r...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1319</th>\n",
       "      <td>番茄炖牛腩\\r\\n\\r\\n\\r\\n油焖麻辣虾清炒菊花菜南瓜枸杞小饼干麻辣小龙虾倒立蒸梭子蟹爆...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1323</th>\n",
       "      <td>蒜蓉生蚝清蒸海鱼芝士烩波士顿龙虾海带结豆腐汤芹黄鳝丝番茄炖牛腩\\r\\n\\r\\n\\r\\n爆炒双...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>278 rows × 1 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                                dishes_name\n",
       "order_id                                                   \n",
       "137           西瓜胡萝卜沙拉麻辣小龙虾农夫山泉NFC果汁100%橙汁番茄炖牛腩\\r\\n白饭/小碗凉拌菠菜\n",
       "165       芝士烩波士顿龙虾清蒸海鱼百里香奶油烤紅酒牛肉辣炒鱿鱼爆炒猪肝啤酒鸭干锅田鸡番茄蛋汤黄花菜炒木...\n",
       "166                                 水煮鱼葱姜炒蟹啤酒鸭百威啤酒罐装大理石奶油蛋糕\n",
       "171                   油焖麻辣虾蒜香辣花甲蒜蓉生蚝番茄有机花菜谷稻小庄 白饭/大碗冰糖红豆薏米粥\n",
       "177                                蒜香辣花甲桂圆枸杞鸽子汤照烧鸡腿\\r\\n青炒扁豆\n",
       "...                                                     ...\n",
       "1309      花蛤蒸蛋芹黄鳝丝玉竹南北杏鸭腿汤番茄有机花菜五彩藕苗孜然羊排谷稻小庄 黄尾袋鼠西拉子红葡萄酒...\n",
       "1314      香辣腐乳炒虾盘蟹蒸蛋清蒸蝶鱼党参黄芪炖牛尾\\r\\n\\r\\n\\r\\n牛尾汤爆炒双丝独家薄荷鲜虾...\n",
       "1317      芝士烩波士顿龙虾倒立蒸梭子蟹清蒸海鱼蒜蓉生蚝快炒黄鳝培根紫菜卷番茄炖牛腩\\r\\n\\r\\n\\r...\n",
       "1319      番茄炖牛腩\\r\\n\\r\\n\\r\\n油焖麻辣虾清炒菊花菜南瓜枸杞小饼干麻辣小龙虾倒立蒸梭子蟹爆...\n",
       "1323      蒜蓉生蚝清蒸海鱼芝士烩波士顿龙虾海带结豆腐汤芹黄鳝丝番茄炖牛腩\\r\\n\\r\\n\\r\\n爆炒双...\n",
       "\n",
       "[278 rows x 1 columns]"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.pivot_table(detail[['order_id','dishes_name','counts','amounts']],index='order_id',values='dishes_name',aggfunc=np.sum)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th>counts</th>\n",
       "      <th>1</th>\n",
       "      <th>2</th>\n",
       "      <th>3</th>\n",
       "      <th>4</th>\n",
       "      <th>5</th>\n",
       "      <th>6</th>\n",
       "      <th>7</th>\n",
       "      <th>8</th>\n",
       "      <th>10</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>order_id</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>137</th>\n",
       "      <td>西瓜胡萝卜沙拉麻辣小龙虾农夫山泉NFC果汁100%橙汁番茄炖牛腩\\r\\n凉拌菠菜</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>白饭/小碗</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>165</th>\n",
       "      <td>清蒸海鱼百里香奶油烤紅酒牛肉辣炒鱿鱼爆炒猪肝啤酒鸭干锅田鸡番茄蛋汤黄花菜炒木耳西瓜胡萝卜沙拉...</td>\n",
       "      <td>芝士烩波士顿龙虾蓝带啤酒罐装白饭/大碗</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>166</th>\n",
       "      <td>水煮鱼葱姜炒蟹啤酒鸭</td>\n",
       "      <td>百威啤酒罐装大理石奶油蛋糕</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>171</th>\n",
       "      <td>油焖麻辣虾蒜香辣花甲蒜蓉生蚝番茄有机花菜谷稻小庄 白饭/大碗</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>冰糖红豆薏米粥</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>177</th>\n",
       "      <td>蒜香辣花甲桂圆枸杞鸽子汤照烧鸡腿\\r\\n青炒扁豆</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1309</th>\n",
       "      <td>花蛤蒸蛋芹黄鳝丝玉竹南北杏鸭腿汤番茄有机花菜五彩藕苗孜然羊排谷稻小庄 黄尾袋鼠西拉子红葡萄酒...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>白饭/小碗</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1314</th>\n",
       "      <td>香辣腐乳炒虾盘蟹蒸蛋清蒸蝶鱼党参黄芪炖牛尾\\r\\n\\r\\n\\r\\n牛尾汤爆炒双丝独家薄荷鲜虾...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1317</th>\n",
       "      <td>芝士烩波士顿龙虾倒立蒸梭子蟹清蒸海鱼蒜蓉生蚝快炒黄鳝培根紫菜卷番茄炖牛腩\\r\\n\\r\\n\\r...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1319</th>\n",
       "      <td>番茄炖牛腩\\r\\n\\r\\n\\r\\n油焖麻辣虾清炒菊花菜南瓜枸杞小饼干麻辣小龙虾倒立蒸梭子蟹爆...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1323</th>\n",
       "      <td>蒜蓉生蚝清蒸海鱼芝士烩波士顿龙虾海带结豆腐汤芹黄鳝丝番茄炖牛腩\\r\\n\\r\\n\\r\\n爆炒双...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>278 rows × 9 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "counts                                                   1   \\\n",
       "order_id                                                      \n",
       "137                西瓜胡萝卜沙拉麻辣小龙虾农夫山泉NFC果汁100%橙汁番茄炖牛腩\\r\\n凉拌菠菜   \n",
       "165       清蒸海鱼百里香奶油烤紅酒牛肉辣炒鱿鱼爆炒猪肝啤酒鸭干锅田鸡番茄蛋汤黄花菜炒木耳西瓜胡萝卜沙拉...   \n",
       "166                                              水煮鱼葱姜炒蟹啤酒鸭   \n",
       "171                          油焖麻辣虾蒜香辣花甲蒜蓉生蚝番茄有机花菜谷稻小庄 白饭/大碗   \n",
       "177                                蒜香辣花甲桂圆枸杞鸽子汤照烧鸡腿\\r\\n青炒扁豆   \n",
       "...                                                     ...   \n",
       "1309      花蛤蒸蛋芹黄鳝丝玉竹南北杏鸭腿汤番茄有机花菜五彩藕苗孜然羊排谷稻小庄 黄尾袋鼠西拉子红葡萄酒...   \n",
       "1314      香辣腐乳炒虾盘蟹蒸蛋清蒸蝶鱼党参黄芪炖牛尾\\r\\n\\r\\n\\r\\n牛尾汤爆炒双丝独家薄荷鲜虾...   \n",
       "1317      芝士烩波士顿龙虾倒立蒸梭子蟹清蒸海鱼蒜蓉生蚝快炒黄鳝培根紫菜卷番茄炖牛腩\\r\\n\\r\\n\\r...   \n",
       "1319      番茄炖牛腩\\r\\n\\r\\n\\r\\n油焖麻辣虾清炒菊花菜南瓜枸杞小饼干麻辣小龙虾倒立蒸梭子蟹爆...   \n",
       "1323      蒜蓉生蚝清蒸海鱼芝士烩波士顿龙虾海带结豆腐汤芹黄鳝丝番茄炖牛腩\\r\\n\\r\\n\\r\\n爆炒双...   \n",
       "\n",
       "counts                     2      3        4    5    6    7    8    10  \n",
       "order_id                                                                \n",
       "137                       NaN    NaN    白饭/小碗  NaN  NaN  NaN  NaN  NaN  \n",
       "165       芝士烩波士顿龙虾蓝带啤酒罐装白饭/大碗    NaN      NaN  NaN  NaN  NaN  NaN  NaN  \n",
       "166             百威啤酒罐装大理石奶油蛋糕    NaN      NaN  NaN  NaN  NaN  NaN  NaN  \n",
       "171                       NaN    NaN  冰糖红豆薏米粥  NaN  NaN  NaN  NaN  NaN  \n",
       "177                       NaN    NaN      NaN  NaN  NaN  NaN  NaN  NaN  \n",
       "...                       ...    ...      ...  ...  ...  ...  ...  ...  \n",
       "1309                      NaN  白饭/小碗      NaN  NaN  NaN  NaN  NaN  NaN  \n",
       "1314                      NaN    NaN      NaN  NaN  NaN  NaN  NaN  NaN  \n",
       "1317                      NaN    NaN      NaN  NaN  NaN  NaN  NaN  NaN  \n",
       "1319                      NaN    NaN      NaN  NaN  NaN  NaN  NaN  NaN  \n",
       "1323                      NaN    NaN      NaN  NaN  NaN  NaN  NaN  NaN  \n",
       "\n",
       "[278 rows x 9 columns]"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.pivot_table(detail[['order_id','dishes_name','counts','amounts']],index='order_id',values='dishes_name',columns='counts',aggfunc=np.sum)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th>counts</th>\n",
       "      <th>1</th>\n",
       "      <th>2</th>\n",
       "      <th>3</th>\n",
       "      <th>4</th>\n",
       "      <th>5</th>\n",
       "      <th>6</th>\n",
       "      <th>7</th>\n",
       "      <th>8</th>\n",
       "      <th>10</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>order_id</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>137</th>\n",
       "      <td>西瓜胡萝卜沙拉麻辣小龙虾农夫山泉NFC果汁100%橙汁番茄炖牛腩\\r\\n凉拌菠菜</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>白饭/小碗</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>165</th>\n",
       "      <td>清蒸海鱼百里香奶油烤紅酒牛肉辣炒鱿鱼爆炒猪肝啤酒鸭干锅田鸡番茄蛋汤黄花菜炒木耳西瓜胡萝卜沙拉...</td>\n",
       "      <td>芝士烩波士顿龙虾蓝带啤酒罐装白饭/大碗</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>166</th>\n",
       "      <td>水煮鱼葱姜炒蟹啤酒鸭</td>\n",
       "      <td>百威啤酒罐装大理石奶油蛋糕</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>171</th>\n",
       "      <td>油焖麻辣虾蒜香辣花甲蒜蓉生蚝番茄有机花菜谷稻小庄 白饭/大碗</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>冰糖红豆薏米粥</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>177</th>\n",
       "      <td>蒜香辣花甲桂圆枸杞鸽子汤照烧鸡腿\\r\\n青炒扁豆</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1309</th>\n",
       "      <td>花蛤蒸蛋芹黄鳝丝玉竹南北杏鸭腿汤番茄有机花菜五彩藕苗孜然羊排谷稻小庄 黄尾袋鼠西拉子红葡萄酒...</td>\n",
       "      <td>0</td>\n",
       "      <td>白饭/小碗</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1314</th>\n",
       "      <td>香辣腐乳炒虾盘蟹蒸蛋清蒸蝶鱼党参黄芪炖牛尾\\r\\n\\r\\n\\r\\n牛尾汤爆炒双丝独家薄荷鲜虾...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1317</th>\n",
       "      <td>芝士烩波士顿龙虾倒立蒸梭子蟹清蒸海鱼蒜蓉生蚝快炒黄鳝培根紫菜卷番茄炖牛腩\\r\\n\\r\\n\\r...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1319</th>\n",
       "      <td>番茄炖牛腩\\r\\n\\r\\n\\r\\n油焖麻辣虾清炒菊花菜南瓜枸杞小饼干麻辣小龙虾倒立蒸梭子蟹爆...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1323</th>\n",
       "      <td>蒜蓉生蚝清蒸海鱼芝士烩波士顿龙虾海带结豆腐汤芹黄鳝丝番茄炖牛腩\\r\\n\\r\\n\\r\\n爆炒双...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>278 rows × 9 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "counts                                                   1   \\\n",
       "order_id                                                      \n",
       "137                西瓜胡萝卜沙拉麻辣小龙虾农夫山泉NFC果汁100%橙汁番茄炖牛腩\\r\\n凉拌菠菜   \n",
       "165       清蒸海鱼百里香奶油烤紅酒牛肉辣炒鱿鱼爆炒猪肝啤酒鸭干锅田鸡番茄蛋汤黄花菜炒木耳西瓜胡萝卜沙拉...   \n",
       "166                                              水煮鱼葱姜炒蟹啤酒鸭   \n",
       "171                          油焖麻辣虾蒜香辣花甲蒜蓉生蚝番茄有机花菜谷稻小庄 白饭/大碗   \n",
       "177                                蒜香辣花甲桂圆枸杞鸽子汤照烧鸡腿\\r\\n青炒扁豆   \n",
       "...                                                     ...   \n",
       "1309      花蛤蒸蛋芹黄鳝丝玉竹南北杏鸭腿汤番茄有机花菜五彩藕苗孜然羊排谷稻小庄 黄尾袋鼠西拉子红葡萄酒...   \n",
       "1314      香辣腐乳炒虾盘蟹蒸蛋清蒸蝶鱼党参黄芪炖牛尾\\r\\n\\r\\n\\r\\n牛尾汤爆炒双丝独家薄荷鲜虾...   \n",
       "1317      芝士烩波士顿龙虾倒立蒸梭子蟹清蒸海鱼蒜蓉生蚝快炒黄鳝培根紫菜卷番茄炖牛腩\\r\\n\\r\\n\\r...   \n",
       "1319      番茄炖牛腩\\r\\n\\r\\n\\r\\n油焖麻辣虾清炒菊花菜南瓜枸杞小饼干麻辣小龙虾倒立蒸梭子蟹爆...   \n",
       "1323      蒜蓉生蚝清蒸海鱼芝士烩波士顿龙虾海带结豆腐汤芹黄鳝丝番茄炖牛腩\\r\\n\\r\\n\\r\\n爆炒双...   \n",
       "\n",
       "counts                     2      3        4  5  6  7  8  10  \n",
       "order_id                                                      \n",
       "137                         0      0    白饭/小碗  0  0  0  0  0  \n",
       "165       芝士烩波士顿龙虾蓝带啤酒罐装白饭/大碗      0        0  0  0  0  0  0  \n",
       "166             百威啤酒罐装大理石奶油蛋糕      0        0  0  0  0  0  0  \n",
       "171                         0      0  冰糖红豆薏米粥  0  0  0  0  0  \n",
       "177                         0      0        0  0  0  0  0  0  \n",
       "...                       ...    ...      ... .. .. .. .. ..  \n",
       "1309                        0  白饭/小碗        0  0  0  0  0  0  \n",
       "1314                        0      0        0  0  0  0  0  0  \n",
       "1317                        0      0        0  0  0  0  0  0  \n",
       "1319                        0      0        0  0  0  0  0  0  \n",
       "1323                        0      0        0  0  0  0  0  0  \n",
       "\n",
       "[278 rows x 9 columns]"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.pivot_table(detail[['order_id','dishes_name','counts','amounts']],index='order_id',values='dishes_name',columns='counts',aggfunc=np.sum,fill_value=0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead tr th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe thead tr:last-of-type th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr>\n",
       "      <th></th>\n",
       "      <th colspan=\"10\" halign=\"left\">amounts</th>\n",
       "      <th>...</th>\n",
       "      <th colspan=\"10\" halign=\"left\">counts</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dishes_name</th>\n",
       "      <th>42度海之蓝</th>\n",
       "      <th>北冰洋汽水</th>\n",
       "      <th>38度剑南春</th>\n",
       "      <th>50度古井贡酒</th>\n",
       "      <th>52度泸州老窖</th>\n",
       "      <th>53度茅台</th>\n",
       "      <th>一品香酥藕</th>\n",
       "      <th>三丝鳝鱼</th>\n",
       "      <th>三色凉拌手撕兔</th>\n",
       "      <th>不加一滴油的酸奶蛋糕</th>\n",
       "      <th>...</th>\n",
       "      <th>香酥两吃大虾</th>\n",
       "      <th>鱼香肉丝拌面</th>\n",
       "      <th>鲜美鳝鱼</th>\n",
       "      <th>鸡蛋、肉末肠粉</th>\n",
       "      <th>麻辣小龙虾</th>\n",
       "      <th>黄尾袋鼠西拉子红葡萄酒</th>\n",
       "      <th>黄油曲奇饼干</th>\n",
       "      <th>黄花菜炒木耳</th>\n",
       "      <th>黑米恋上葡萄</th>\n",
       "      <th>All</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>order_id</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>137</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>165</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>80</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>10</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>21</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>166</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>7</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>171</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>10</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>177</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1314</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>80</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>12</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1317</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>128</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>18</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1319</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1323</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>80</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>15</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>All</th>\n",
       "      <td>297</td>\n",
       "      <td>115</td>\n",
       "      <td>480</td>\n",
       "      <td>450</td>\n",
       "      <td>1272</td>\n",
       "      <td>640</td>\n",
       "      <td>110</td>\n",
       "      <td>110</td>\n",
       "      <td>396</td>\n",
       "      <td>49</td>\n",
       "      <td>...</td>\n",
       "      <td>38</td>\n",
       "      <td>12</td>\n",
       "      <td>10</td>\n",
       "      <td>3</td>\n",
       "      <td>66</td>\n",
       "      <td>16</td>\n",
       "      <td>5</td>\n",
       "      <td>15</td>\n",
       "      <td>18</td>\n",
       "      <td>3088</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>279 rows × 310 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "            amounts                                                            \\\n",
       "dishes_name  42度海之蓝  北冰洋汽水  38度剑南春  50度古井贡酒 52度泸州老窖  53度茅台 一品香酥藕 三丝鳝鱼 三色凉拌手撕兔   \n",
       "order_id                                                                        \n",
       "137               0       0       0       0        0     0     0    0       0   \n",
       "165               0       0      80       0        0     0    10    0       0   \n",
       "166               0       0       0       0        0     0     0    0       0   \n",
       "171               0       0       0       0        0     0     0    0       0   \n",
       "177               0       0       0       0        0     0     0    0       0   \n",
       "...             ...     ...     ...     ...      ...   ...   ...  ...     ...   \n",
       "1314              0       0      80       0        0     0     0    0       0   \n",
       "1317              0       0       0       0        0   128     0    0       0   \n",
       "1319              0       0       0       0        0     0     0    0       0   \n",
       "1323              0       0      80       0        0     0     0    0       0   \n",
       "All             297     115     480     450     1272   640   110  110     396   \n",
       "\n",
       "                        ... counts                                        \\\n",
       "dishes_name 不加一滴油的酸奶蛋糕  ... 香酥两吃大虾 鱼香肉丝拌面 鲜美鳝鱼 鸡蛋、肉末肠粉 麻辣小龙虾 黄尾袋鼠西拉子红葡萄酒   \n",
       "order_id                ...                                                \n",
       "137                  0  ...      0      0    0       0     1           0   \n",
       "165                  0  ...      0      0    0       0     0           0   \n",
       "166                  0  ...      0      0    0       0     0           0   \n",
       "171                  0  ...      0      0    0       0     0           0   \n",
       "177                  0  ...      0      0    0       0     0           0   \n",
       "...                ...  ...    ...    ...  ...     ...   ...         ...   \n",
       "1314                 0  ...      0      0    0       0     0           0   \n",
       "1317                 0  ...      0      0    0       0     0           0   \n",
       "1319                 0  ...      0      0    0       0     1           0   \n",
       "1323                 0  ...      0      0    0       0     0           0   \n",
       "All                 49  ...     38     12   10       3    66          16   \n",
       "\n",
       "                                        \n",
       "dishes_name 黄油曲奇饼干 黄花菜炒木耳 黑米恋上葡萄   All  \n",
       "order_id                                \n",
       "137              0      0      0     9  \n",
       "165              0      1      0    21  \n",
       "166              0      0      0     7  \n",
       "171              0      0      0    10  \n",
       "177              0      0      0     4  \n",
       "...            ...    ...    ...   ...  \n",
       "1314             0      0      0    12  \n",
       "1317             0      0      0    18  \n",
       "1319             0      0      0     9  \n",
       "1323             0      0      0    15  \n",
       "All              5     15     18  3088  \n",
       "\n",
       "[279 rows x 310 columns]"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.pivot_table(detail[['order_id','dishes_name','counts','amounts']],index='order_id',columns='dishes_name',aggfunc=np.sum,fill_value=0,margins=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th>amounts</th>\n",
       "      <th>counts</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>order_id</th>\n",
       "      <th>dishes_name</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th rowspan=\"5\" valign=\"top\">137</th>\n",
       "      <th>农夫山泉NFC果汁100%橙汁</th>\n",
       "      <td>6</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>凉拌菠菜</th>\n",
       "      <td>27</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>番茄炖牛腩\\r\\n</th>\n",
       "      <td>35</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>白饭/小碗</th>\n",
       "      <td>1</td>\n",
       "      <td>4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>西瓜胡萝卜沙拉</th>\n",
       "      <td>26</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"5\" valign=\"top\">1323</th>\n",
       "      <th>番茄炖秋葵</th>\n",
       "      <td>35</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>芝士烩波士顿龙虾</th>\n",
       "      <td>175</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>芹黄鳝丝</th>\n",
       "      <td>58</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>蒜蓉生蚝</th>\n",
       "      <td>49</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>谷稻小庄</th>\n",
       "      <td>38</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>2778 rows × 2 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                          amounts  counts\n",
       "order_id dishes_name                     \n",
       "137      农夫山泉NFC果汁100%橙汁        6       1\n",
       "         凉拌菠菜                  27       1\n",
       "         番茄炖牛腩\\r\\n             35       1\n",
       "         白饭/小碗                  1       4\n",
       "         西瓜胡萝卜沙拉               26       1\n",
       "...                           ...     ...\n",
       "1323     番茄炖秋葵                 35       1\n",
       "         芝士烩波士顿龙虾             175       1\n",
       "         芹黄鳝丝                  58       1\n",
       "         蒜蓉生蚝                  49       1\n",
       "         谷稻小庄                  38       1\n",
       "\n",
       "[2778 rows x 2 columns]"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.pivot_table(detail[['order_id','dishes_name','counts','amounts']],index=['order_id','dishes_name'],aggfunc=np.sum)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th>amounts</th>\n",
       "      <th>counts</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dishes_name</th>\n",
       "      <th>order_id</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th rowspan=\"3\" valign=\"top\">42度海之蓝</th>\n",
       "      <th>415</th>\n",
       "      <td>99</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>681</th>\n",
       "      <td>99</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1011</th>\n",
       "      <td>99</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"2\" valign=\"top\">北冰洋汽水</th>\n",
       "      <th>283</th>\n",
       "      <td>5</td>\n",
       "      <td>3</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>314</th>\n",
       "      <td>5</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th rowspan=\"5\" valign=\"top\">黑米恋上葡萄</th>\n",
       "      <th>831</th>\n",
       "      <td>33</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>881</th>\n",
       "      <td>33</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1027</th>\n",
       "      <td>33</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1146</th>\n",
       "      <td>33</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1173</th>\n",
       "      <td>33</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>2778 rows × 2 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                      amounts  counts\n",
       "dishes_name order_id                 \n",
       " 42度海之蓝     415            99       1\n",
       "            681            99       3\n",
       "            1011           99       1\n",
       " 北冰洋汽水      283             5       3\n",
       "            314             5       1\n",
       "...                       ...     ...\n",
       "黑米恋上葡萄      831            33       1\n",
       "            881            33       1\n",
       "            1027           33       1\n",
       "            1146           33       1\n",
       "            1173           33       1\n",
       "\n",
       "[2778 rows x 2 columns]"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.pivot_table(detail[['order_id','dishes_name','counts','amounts']],index=['dishes_name','order_id'],aggfunc=np.sum)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>add_info</th>\n",
       "      <th>add_inprice</th>\n",
       "      <th>amounts</th>\n",
       "      <th>bar_code</th>\n",
       "      <th>cost</th>\n",
       "      <th>counts</th>\n",
       "      <th>detail_id</th>\n",
       "      <th>discount_amt</th>\n",
       "      <th>discount_reason</th>\n",
       "      <th>dishes_id</th>\n",
       "      <th>emp_id</th>\n",
       "      <th>itemis_add</th>\n",
       "      <th>kick_back</th>\n",
       "      <th>logicprn_name</th>\n",
       "      <th>parent_class_name</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>order_id</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>137</th>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>194</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>9</td>\n",
       "      <td>4539</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>3659917</td>\n",
       "      <td>7488</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>165</th>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>953</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>21</td>\n",
       "      <td>15541</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>10979749</td>\n",
       "      <td>19746</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>166</th>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>241</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>7</td>\n",
       "      <td>4336</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>3049891</td>\n",
       "      <td>4930</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>171</th>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>254</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>10</td>\n",
       "      <td>6280</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>4270017</td>\n",
       "      <td>10241</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>177</th>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>137</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>4</td>\n",
       "      <td>3771</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>2440108</td>\n",
       "      <td>4564</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1309</th>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>443</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>15</td>\n",
       "      <td>79720</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>7930045</td>\n",
       "      <td>18759</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1314</th>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>508</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>12</td>\n",
       "      <td>74395</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>7320128</td>\n",
       "      <td>13560</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1317</th>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>1210</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>18</td>\n",
       "      <td>112455</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>10980003</td>\n",
       "      <td>20754</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1319</th>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>610</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>9</td>\n",
       "      <td>37134</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>5489726</td>\n",
       "      <td>13743</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1323</th>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>764</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>15</td>\n",
       "      <td>66389</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>9150088</td>\n",
       "      <td>18120</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>278 rows × 15 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "          add_info  add_inprice  amounts  bar_code  cost  counts  detail_id  \\\n",
       "order_id                                                                      \n",
       "137            0.0            0      194       0.0   0.0       9       4539   \n",
       "165            0.0            0      953       0.0   0.0      21      15541   \n",
       "166            0.0            0      241       0.0   0.0       7       4336   \n",
       "171            0.0            0      254       0.0   0.0      10       6280   \n",
       "177            0.0            0      137       0.0   0.0       4       3771   \n",
       "...            ...          ...      ...       ...   ...     ...        ...   \n",
       "1309           0.0            0      443       0.0   0.0      15      79720   \n",
       "1314           0.0            0      508       0.0   0.0      12      74395   \n",
       "1317           0.0            0     1210       0.0   0.0      18     112455   \n",
       "1319           0.0            0      610       0.0   0.0       9      37134   \n",
       "1323           0.0            0      764       0.0   0.0      15      66389   \n",
       "\n",
       "          discount_amt  discount_reason  dishes_id  emp_id  itemis_add  \\\n",
       "order_id                                                                 \n",
       "137                0.0              0.0    3659917    7488           0   \n",
       "165                0.0              0.0   10979749   19746           0   \n",
       "166                0.0              0.0    3049891    4930           0   \n",
       "171                0.0              0.0    4270017   10241           0   \n",
       "177                0.0              0.0    2440108    4564           0   \n",
       "...                ...              ...        ...     ...         ...   \n",
       "1309               0.0              0.0    7930045   18759           0   \n",
       "1314               0.0              0.0    7320128   13560           0   \n",
       "1317               0.0              0.0   10980003   20754           0   \n",
       "1319               0.0              0.0    5489726   13743           0   \n",
       "1323               0.0              0.0    9150088   18120           0   \n",
       "\n",
       "          kick_back  logicprn_name  parent_class_name  \n",
       "order_id                                               \n",
       "137             0.0            0.0                0.0  \n",
       "165             0.0            0.0                0.0  \n",
       "166             0.0            0.0                0.0  \n",
       "171             0.0            0.0                0.0  \n",
       "177             0.0            0.0                0.0  \n",
       "...             ...            ...                ...  \n",
       "1309            0.0            0.0                0.0  \n",
       "1314            0.0            0.0                0.0  \n",
       "1317            0.0            0.0                0.0  \n",
       "1319            0.0            0.0                0.0  \n",
       "1323            0.0            0.0                0.0  \n",
       "\n",
       "[278 rows x 15 columns]"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.pivot_table(detail,index='order_id',aggfunc=np.sum)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>add_info</th>\n",
       "      <th>add_inprice</th>\n",
       "      <th>amounts</th>\n",
       "      <th>bar_code</th>\n",
       "      <th>cost</th>\n",
       "      <th>counts</th>\n",
       "      <th>detail_id</th>\n",
       "      <th>discount_amt</th>\n",
       "      <th>discount_reason</th>\n",
       "      <th>dishes_id</th>\n",
       "      <th>emp_id</th>\n",
       "      <th>itemis_add</th>\n",
       "      <th>kick_back</th>\n",
       "      <th>logicprn_name</th>\n",
       "      <th>parent_class_name</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>order_id</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>137</th>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>194</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>9</td>\n",
       "      <td>4539</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>3659917</td>\n",
       "      <td>7488</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>165</th>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>953</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>21</td>\n",
       "      <td>15541</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>10979749</td>\n",
       "      <td>19746</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>166</th>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>241</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>7</td>\n",
       "      <td>4336</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>3049891</td>\n",
       "      <td>4930</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>171</th>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>254</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>10</td>\n",
       "      <td>6280</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>4270017</td>\n",
       "      <td>10241</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>177</th>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>137</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>4</td>\n",
       "      <td>3771</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>2440108</td>\n",
       "      <td>4564</td>\n",
       "      <td>0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "          add_info  add_inprice  amounts  bar_code  cost  counts  detail_id  \\\n",
       "order_id                                                                      \n",
       "137            0.0            0      194       0.0   0.0       9       4539   \n",
       "165            0.0            0      953       0.0   0.0      21      15541   \n",
       "166            0.0            0      241       0.0   0.0       7       4336   \n",
       "171            0.0            0      254       0.0   0.0      10       6280   \n",
       "177            0.0            0      137       0.0   0.0       4       3771   \n",
       "\n",
       "          discount_amt  discount_reason  dishes_id  emp_id  itemis_add  \\\n",
       "order_id                                                                 \n",
       "137                0.0              0.0    3659917    7488           0   \n",
       "165                0.0              0.0   10979749   19746           0   \n",
       "166                0.0              0.0    3049891    4930           0   \n",
       "171                0.0              0.0    4270017   10241           0   \n",
       "177                0.0              0.0    2440108    4564           0   \n",
       "\n",
       "          kick_back  logicprn_name  parent_class_name  \n",
       "order_id                                               \n",
       "137             0.0            0.0                0.0  \n",
       "165             0.0            0.0                0.0  \n",
       "166             0.0            0.0                0.0  \n",
       "171             0.0            0.0                0.0  \n",
       "177             0.0            0.0                0.0  "
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.pivot_table(detail,index='order_id',aggfunc=np.sum).head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>add_info</th>\n",
       "      <th>add_inprice</th>\n",
       "      <th>amounts</th>\n",
       "      <th>bar_code</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>order_id</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>137</th>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>194</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>165</th>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>953</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>166</th>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>241</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>171</th>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>254</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>177</th>\n",
       "      <td>0.0</td>\n",
       "      <td>0</td>\n",
       "      <td>137</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "          add_info  add_inprice  amounts  bar_code\n",
       "order_id                                          \n",
       "137            0.0            0      194       0.0\n",
       "165            0.0            0      953       0.0\n",
       "166            0.0            0      241       0.0\n",
       "171            0.0            0      254       0.0\n",
       "177            0.0            0      137       0.0"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.pivot_table(detail,index='order_id',aggfunc=np.sum).iloc[:5,:4]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th>dishes_name</th>\n",
       "      <th>42度海之蓝</th>\n",
       "      <th>北冰洋汽水</th>\n",
       "      <th>38度剑南春</th>\n",
       "      <th>50度古井贡酒</th>\n",
       "      <th>52度泸州老窖</th>\n",
       "      <th>53度茅台</th>\n",
       "      <th>一品香酥藕</th>\n",
       "      <th>三丝鳝鱼</th>\n",
       "      <th>三色凉拌手撕兔</th>\n",
       "      <th>不加一滴油的酸奶蛋糕</th>\n",
       "      <th>...</th>\n",
       "      <th>香辣腐乳炒虾</th>\n",
       "      <th>香酥两吃大虾</th>\n",
       "      <th>鱼香肉丝拌面</th>\n",
       "      <th>鲜美鳝鱼</th>\n",
       "      <th>鸡蛋、肉末肠粉</th>\n",
       "      <th>麻辣小龙虾</th>\n",
       "      <th>黄尾袋鼠西拉子红葡萄酒</th>\n",
       "      <th>黄油曲奇饼干</th>\n",
       "      <th>黄花菜炒木耳</th>\n",
       "      <th>黑米恋上葡萄</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>order_id</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>137</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>165</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1.0</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>166</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>171</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>177</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1309</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1314</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>1.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1317</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1319</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1323</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>278 rows × 154 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "dishes_name   42度海之蓝   北冰洋汽水   38度剑南春   50度古井贡酒  52度泸州老窖   53度茅台  一品香酥藕  三丝鳝鱼  \\\n",
       "order_id                                                                        \n",
       "137              NaN      NaN      NaN      NaN       NaN    NaN    NaN   NaN   \n",
       "165              NaN      NaN      1.0      NaN       NaN    NaN    1.0   NaN   \n",
       "166              NaN      NaN      NaN      NaN       NaN    NaN    NaN   NaN   \n",
       "171              NaN      NaN      NaN      NaN       NaN    NaN    NaN   NaN   \n",
       "177              NaN      NaN      NaN      NaN       NaN    NaN    NaN   NaN   \n",
       "...              ...      ...      ...      ...       ...    ...    ...   ...   \n",
       "1309             NaN      NaN      NaN      NaN       NaN    NaN    1.0   NaN   \n",
       "1314             NaN      NaN      1.0      NaN       NaN    NaN    NaN   NaN   \n",
       "1317             NaN      NaN      NaN      NaN       NaN    1.0    NaN   NaN   \n",
       "1319             NaN      NaN      NaN      NaN       NaN    NaN    NaN   NaN   \n",
       "1323             NaN      NaN      1.0      NaN       NaN    NaN    NaN   NaN   \n",
       "\n",
       "dishes_name  三色凉拌手撕兔  不加一滴油的酸奶蛋糕  ...  香辣腐乳炒虾  香酥两吃大虾  鱼香肉丝拌面  鲜美鳝鱼  鸡蛋、肉末肠粉  \\\n",
       "order_id                          ...                                          \n",
       "137              NaN         NaN  ...     NaN     NaN     NaN   NaN      NaN   \n",
       "165              NaN         NaN  ...     NaN     NaN     NaN   NaN      NaN   \n",
       "166              NaN         NaN  ...     NaN     NaN     NaN   NaN      NaN   \n",
       "171              NaN         NaN  ...     NaN     NaN     NaN   NaN      NaN   \n",
       "177              NaN         NaN  ...     NaN     NaN     NaN   NaN      NaN   \n",
       "...              ...         ...  ...     ...     ...     ...   ...      ...   \n",
       "1309             NaN         NaN  ...     NaN     NaN     1.0   NaN      NaN   \n",
       "1314             NaN         NaN  ...     1.0     NaN     NaN   NaN      NaN   \n",
       "1317             NaN         NaN  ...     NaN     NaN     NaN   NaN      NaN   \n",
       "1319             NaN         NaN  ...     NaN     NaN     NaN   NaN      NaN   \n",
       "1323             NaN         NaN  ...     NaN     NaN     NaN   NaN      NaN   \n",
       "\n",
       "dishes_name  麻辣小龙虾  黄尾袋鼠西拉子红葡萄酒  黄油曲奇饼干  黄花菜炒木耳  黑米恋上葡萄  \n",
       "order_id                                                 \n",
       "137            1.0          NaN     NaN     NaN     NaN  \n",
       "165            NaN          NaN     NaN     1.0     NaN  \n",
       "166            NaN          NaN     NaN     NaN     NaN  \n",
       "171            NaN          NaN     NaN     NaN     NaN  \n",
       "177            NaN          NaN     NaN     NaN     NaN  \n",
       "...            ...          ...     ...     ...     ...  \n",
       "1309           NaN          1.0     NaN     NaN     NaN  \n",
       "1314           NaN          NaN     NaN     NaN     NaN  \n",
       "1317           NaN          NaN     NaN     NaN     NaN  \n",
       "1319           1.0          NaN     NaN     NaN     NaN  \n",
       "1323           NaN          NaN     NaN     NaN     NaN  \n",
       "\n",
       "[278 rows x 154 columns]"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "detailCross=pd.crosstab(index=detail['order_id'],columns=detail['dishes_name'],values=detail['counts'],aggfunc=np.sum)\n",
    "detailCross"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [
    {
     "ename": "ValueError",
     "evalue": "aggfunc cannot be used without values.",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mValueError\u001b[0m                                Traceback (most recent call last)",
      "\u001b[1;32m<ipython-input-38-aef9746e7051>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mdetailCross\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mpd\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mcrosstab\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mindex\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mdetail\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m'place_order_time'\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m,\u001b[0m\u001b[0mcolumns\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mdetail\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m'counts'\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m,\u001b[0m\u001b[0maggfunc\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mnp\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mmean\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m      2\u001b[0m \u001b[0mdetailCross\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;32mD:\\Anaconda3\\lib\\site-packages\\pandas\\core\\reshape\\pivot.py\u001b[0m in \u001b[0;36mcrosstab\u001b[1;34m(index, columns, values, rownames, colnames, aggfunc, margins, margins_name, dropna, normalize)\u001b[0m\n\u001b[0;32m    574\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    575\u001b[0m     \u001b[1;32mif\u001b[0m \u001b[0mvalues\u001b[0m \u001b[1;32mis\u001b[0m \u001b[1;32mNone\u001b[0m \u001b[1;32mand\u001b[0m \u001b[0maggfunc\u001b[0m \u001b[1;32mis\u001b[0m \u001b[1;32mnot\u001b[0m \u001b[1;32mNone\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 576\u001b[1;33m         \u001b[1;32mraise\u001b[0m \u001b[0mValueError\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;34m\"aggfunc cannot be used without values.\"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m    577\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    578\u001b[0m     \u001b[1;32mif\u001b[0m \u001b[0mvalues\u001b[0m \u001b[1;32mis\u001b[0m \u001b[1;32mnot\u001b[0m \u001b[1;32mNone\u001b[0m \u001b[1;32mand\u001b[0m \u001b[0maggfunc\u001b[0m \u001b[1;32mis\u001b[0m \u001b[1;32mNone\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;31mValueError\u001b[0m: aggfunc cannot be used without values."
     ]
    }
   ],
   "source": [
    "detailCross=pd.crosstab(index=detail['place_order_time'],columns=detail['counts'],aggfunc=np.mean)\n",
    "detailCross"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>detail_id</th>\n",
       "      <th>order_id</th>\n",
       "      <th>dishes_id</th>\n",
       "      <th>logicprn_name</th>\n",
       "      <th>parent_class_name</th>\n",
       "      <th>dishes_name</th>\n",
       "      <th>itemis_add</th>\n",
       "      <th>counts</th>\n",
       "      <th>amounts</th>\n",
       "      <th>cost</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2956</td>\n",
       "      <td>417</td>\n",
       "      <td>610062</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>蒜蓉生蚝</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>49</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2958</td>\n",
       "      <td>417</td>\n",
       "      <td>609957</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>蒙古烤羊腿\\r\\n\\r\\n\\r\\n</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>48</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2961</td>\n",
       "      <td>417</td>\n",
       "      <td>609950</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>大蒜苋菜</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>30</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2966</td>\n",
       "      <td>417</td>\n",
       "      <td>610038</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>芝麻烤紫菜</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>25</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2968</td>\n",
       "      <td>417</td>\n",
       "      <td>610003</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>蒜香包</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>13</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2774</th>\n",
       "      <td>6750</td>\n",
       "      <td>774</td>\n",
       "      <td>610011</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>白饭/大碗</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>10</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2775</th>\n",
       "      <td>6742</td>\n",
       "      <td>774</td>\n",
       "      <td>609996</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>牛尾汤</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>40</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2776</th>\n",
       "      <td>6756</td>\n",
       "      <td>774</td>\n",
       "      <td>609949</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>意文柠檬汁</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>13</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2777</th>\n",
       "      <td>6763</td>\n",
       "      <td>774</td>\n",
       "      <td>610014</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>金玉良缘</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>30</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2778</th>\n",
       "      <td>6764</td>\n",
       "      <td>774</td>\n",
       "      <td>610017</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>酸辣藕丁</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>33</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>2779 rows × 10 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      detail_id  order_id  dishes_id  logicprn_name  parent_class_name  \\\n",
       "0          2956       417     610062            NaN                NaN   \n",
       "1          2958       417     609957            NaN                NaN   \n",
       "2          2961       417     609950            NaN                NaN   \n",
       "3          2966       417     610038            NaN                NaN   \n",
       "4          2968       417     610003            NaN                NaN   \n",
       "...         ...       ...        ...            ...                ...   \n",
       "2774       6750       774     610011            NaN                NaN   \n",
       "2775       6742       774     609996            NaN                NaN   \n",
       "2776       6756       774     609949            NaN                NaN   \n",
       "2777       6763       774     610014            NaN                NaN   \n",
       "2778       6764       774     610017            NaN                NaN   \n",
       "\n",
       "            dishes_name  itemis_add  counts  amounts  cost  \n",
       "0                  蒜蓉生蚝           0       1       49   NaN  \n",
       "1     蒙古烤羊腿\\r\\n\\r\\n\\r\\n           0       1       48   NaN  \n",
       "2                  大蒜苋菜           0       1       30   NaN  \n",
       "3                 芝麻烤紫菜           0       1       25   NaN  \n",
       "4                   蒜香包           0       1       13   NaN  \n",
       "...                 ...         ...     ...      ...   ...  \n",
       "2774              白饭/大碗           0       1       10   NaN  \n",
       "2775                牛尾汤           0       1       40   NaN  \n",
       "2776             意文柠檬汁            0       1       13   NaN  \n",
       "2777               金玉良缘           0       1       30   NaN  \n",
       "2778               酸辣藕丁           0       1       33   NaN  \n",
       "\n",
       "[2779 rows x 10 columns]"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df1=detail.iloc[:,:10]\n",
    "df2=detail.iloc[:,10:]\n",
    "df1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>place_order_time</th>\n",
       "      <th>discount_amt</th>\n",
       "      <th>discount_reason</th>\n",
       "      <th>kick_back</th>\n",
       "      <th>add_inprice</th>\n",
       "      <th>add_info</th>\n",
       "      <th>bar_code</th>\n",
       "      <th>picture_file</th>\n",
       "      <th>emp_id</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2016-08-01 11:05:36</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>caipu/104001.jpg</td>\n",
       "      <td>1442</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2016-08-01 11:07:07</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>caipu/202003.jpg</td>\n",
       "      <td>1442</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2016-08-01 11:07:40</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>caipu/303001.jpg</td>\n",
       "      <td>1442</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2016-08-01 11:11:11</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>caipu/105002.jpg</td>\n",
       "      <td>1442</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2016-08-01 11:11:30</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>caipu/503002.jpg</td>\n",
       "      <td>1442</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2774</th>\n",
       "      <td>2016-08-10 21:56:24</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>caipu/601005.jpg</td>\n",
       "      <td>1138</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2775</th>\n",
       "      <td>2016-08-10 21:56:48</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>caipu/201006.jpg</td>\n",
       "      <td>1138</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2776</th>\n",
       "      <td>2016-08-10 22:01:52</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>caipu/404005.jpg</td>\n",
       "      <td>1138</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2777</th>\n",
       "      <td>2016-08-10 22:03:58</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>caipu/302003.jpg</td>\n",
       "      <td>1138</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2778</th>\n",
       "      <td>2016-08-10 22:04:30</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>caipu/302006.jpg</td>\n",
       "      <td>1138</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>2779 rows × 9 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "        place_order_time  discount_amt  discount_reason  kick_back  \\\n",
       "0    2016-08-01 11:05:36           NaN              NaN        NaN   \n",
       "1    2016-08-01 11:07:07           NaN              NaN        NaN   \n",
       "2    2016-08-01 11:07:40           NaN              NaN        NaN   \n",
       "3    2016-08-01 11:11:11           NaN              NaN        NaN   \n",
       "4    2016-08-01 11:11:30           NaN              NaN        NaN   \n",
       "...                  ...           ...              ...        ...   \n",
       "2774 2016-08-10 21:56:24           NaN              NaN        NaN   \n",
       "2775 2016-08-10 21:56:48           NaN              NaN        NaN   \n",
       "2776 2016-08-10 22:01:52           NaN              NaN        NaN   \n",
       "2777 2016-08-10 22:03:58           NaN              NaN        NaN   \n",
       "2778 2016-08-10 22:04:30           NaN              NaN        NaN   \n",
       "\n",
       "      add_inprice  add_info  bar_code      picture_file  emp_id  \n",
       "0               0       NaN       NaN  caipu/104001.jpg    1442  \n",
       "1               0       NaN       NaN  caipu/202003.jpg    1442  \n",
       "2               0       NaN       NaN  caipu/303001.jpg    1442  \n",
       "3               0       NaN       NaN  caipu/105002.jpg    1442  \n",
       "4               0       NaN       NaN  caipu/503002.jpg    1442  \n",
       "...           ...       ...       ...               ...     ...  \n",
       "2774            0       NaN       NaN  caipu/601005.jpg    1138  \n",
       "2775            0       NaN       NaN  caipu/201006.jpg    1138  \n",
       "2776            0       NaN       NaN  caipu/404005.jpg    1138  \n",
       "2777            0       NaN       NaN  caipu/302003.jpg    1138  \n",
       "2778            0       NaN       NaN  caipu/302006.jpg    1138  \n",
       "\n",
       "[2779 rows x 9 columns]"
      ]
     },
     "execution_count": 44,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>detail_id</th>\n",
       "      <th>order_id</th>\n",
       "      <th>dishes_id</th>\n",
       "      <th>logicprn_name</th>\n",
       "      <th>parent_class_name</th>\n",
       "      <th>dishes_name</th>\n",
       "      <th>itemis_add</th>\n",
       "      <th>counts</th>\n",
       "      <th>amounts</th>\n",
       "      <th>cost</th>\n",
       "      <th>place_order_time</th>\n",
       "      <th>discount_amt</th>\n",
       "      <th>discount_reason</th>\n",
       "      <th>kick_back</th>\n",
       "      <th>add_inprice</th>\n",
       "      <th>add_info</th>\n",
       "      <th>bar_code</th>\n",
       "      <th>picture_file</th>\n",
       "      <th>emp_id</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2956</td>\n",
       "      <td>417</td>\n",
       "      <td>610062</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>蒜蓉生蚝</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>49</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2016-08-01 11:05:36</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>caipu/104001.jpg</td>\n",
       "      <td>1442</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2958</td>\n",
       "      <td>417</td>\n",
       "      <td>609957</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>蒙古烤羊腿\\r\\n\\r\\n\\r\\n</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>48</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2016-08-01 11:07:07</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>caipu/202003.jpg</td>\n",
       "      <td>1442</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2961</td>\n",
       "      <td>417</td>\n",
       "      <td>609950</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>大蒜苋菜</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>30</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2016-08-01 11:07:40</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>caipu/303001.jpg</td>\n",
       "      <td>1442</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2966</td>\n",
       "      <td>417</td>\n",
       "      <td>610038</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>芝麻烤紫菜</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>25</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2016-08-01 11:11:11</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>caipu/105002.jpg</td>\n",
       "      <td>1442</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2968</td>\n",
       "      <td>417</td>\n",
       "      <td>610003</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>蒜香包</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>13</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2016-08-01 11:11:30</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>caipu/503002.jpg</td>\n",
       "      <td>1442</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2774</th>\n",
       "      <td>6750</td>\n",
       "      <td>774</td>\n",
       "      <td>610011</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>白饭/大碗</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>10</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2016-08-10 21:56:24</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>caipu/601005.jpg</td>\n",
       "      <td>1138</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2775</th>\n",
       "      <td>6742</td>\n",
       "      <td>774</td>\n",
       "      <td>609996</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>牛尾汤</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>40</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2016-08-10 21:56:48</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>caipu/201006.jpg</td>\n",
       "      <td>1138</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2776</th>\n",
       "      <td>6756</td>\n",
       "      <td>774</td>\n",
       "      <td>609949</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>意文柠檬汁</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>13</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2016-08-10 22:01:52</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>caipu/404005.jpg</td>\n",
       "      <td>1138</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2777</th>\n",
       "      <td>6763</td>\n",
       "      <td>774</td>\n",
       "      <td>610014</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>金玉良缘</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>30</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2016-08-10 22:03:58</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>caipu/302003.jpg</td>\n",
       "      <td>1138</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2778</th>\n",
       "      <td>6764</td>\n",
       "      <td>774</td>\n",
       "      <td>610017</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>酸辣藕丁</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>33</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2016-08-10 22:04:30</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>caipu/302006.jpg</td>\n",
       "      <td>1138</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>2779 rows × 19 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      detail_id  order_id  dishes_id  logicprn_name  parent_class_name  \\\n",
       "0          2956       417     610062            NaN                NaN   \n",
       "1          2958       417     609957            NaN                NaN   \n",
       "2          2961       417     609950            NaN                NaN   \n",
       "3          2966       417     610038            NaN                NaN   \n",
       "4          2968       417     610003            NaN                NaN   \n",
       "...         ...       ...        ...            ...                ...   \n",
       "2774       6750       774     610011            NaN                NaN   \n",
       "2775       6742       774     609996            NaN                NaN   \n",
       "2776       6756       774     609949            NaN                NaN   \n",
       "2777       6763       774     610014            NaN                NaN   \n",
       "2778       6764       774     610017            NaN                NaN   \n",
       "\n",
       "            dishes_name  itemis_add  counts  amounts  cost  \\\n",
       "0                  蒜蓉生蚝           0       1       49   NaN   \n",
       "1     蒙古烤羊腿\\r\\n\\r\\n\\r\\n           0       1       48   NaN   \n",
       "2                  大蒜苋菜           0       1       30   NaN   \n",
       "3                 芝麻烤紫菜           0       1       25   NaN   \n",
       "4                   蒜香包           0       1       13   NaN   \n",
       "...                 ...         ...     ...      ...   ...   \n",
       "2774              白饭/大碗           0       1       10   NaN   \n",
       "2775                牛尾汤           0       1       40   NaN   \n",
       "2776             意文柠檬汁            0       1       13   NaN   \n",
       "2777               金玉良缘           0       1       30   NaN   \n",
       "2778               酸辣藕丁           0       1       33   NaN   \n",
       "\n",
       "        place_order_time  discount_amt  discount_reason  kick_back  \\\n",
       "0    2016-08-01 11:05:36           NaN              NaN        NaN   \n",
       "1    2016-08-01 11:07:07           NaN              NaN        NaN   \n",
       "2    2016-08-01 11:07:40           NaN              NaN        NaN   \n",
       "3    2016-08-01 11:11:11           NaN              NaN        NaN   \n",
       "4    2016-08-01 11:11:30           NaN              NaN        NaN   \n",
       "...                  ...           ...              ...        ...   \n",
       "2774 2016-08-10 21:56:24           NaN              NaN        NaN   \n",
       "2775 2016-08-10 21:56:48           NaN              NaN        NaN   \n",
       "2776 2016-08-10 22:01:52           NaN              NaN        NaN   \n",
       "2777 2016-08-10 22:03:58           NaN              NaN        NaN   \n",
       "2778 2016-08-10 22:04:30           NaN              NaN        NaN   \n",
       "\n",
       "      add_inprice  add_info  bar_code      picture_file  emp_id  \n",
       "0               0       NaN       NaN  caipu/104001.jpg    1442  \n",
       "1               0       NaN       NaN  caipu/202003.jpg    1442  \n",
       "2               0       NaN       NaN  caipu/303001.jpg    1442  \n",
       "3               0       NaN       NaN  caipu/105002.jpg    1442  \n",
       "4               0       NaN       NaN  caipu/503002.jpg    1442  \n",
       "...           ...       ...       ...               ...     ...  \n",
       "2774            0       NaN       NaN  caipu/601005.jpg    1138  \n",
       "2775            0       NaN       NaN  caipu/201006.jpg    1138  \n",
       "2776            0       NaN       NaN  caipu/404005.jpg    1138  \n",
       "2777            0       NaN       NaN  caipu/302003.jpg    1138  \n",
       "2778            0       NaN       NaN  caipu/302006.jpg    1138  \n",
       "\n",
       "[2779 rows x 19 columns]"
      ]
     },
     "execution_count": 45,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.concat([df1,df2],axis=1,join='inner')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>detail_id</th>\n",
       "      <th>order_id</th>\n",
       "      <th>dishes_id</th>\n",
       "      <th>logicprn_name</th>\n",
       "      <th>parent_class_name</th>\n",
       "      <th>dishes_name</th>\n",
       "      <th>itemis_add</th>\n",
       "      <th>counts</th>\n",
       "      <th>amounts</th>\n",
       "      <th>cost</th>\n",
       "      <th>place_order_time</th>\n",
       "      <th>discount_amt</th>\n",
       "      <th>discount_reason</th>\n",
       "      <th>kick_back</th>\n",
       "      <th>add_inprice</th>\n",
       "      <th>add_info</th>\n",
       "      <th>bar_code</th>\n",
       "      <th>picture_file</th>\n",
       "      <th>emp_id</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2956</td>\n",
       "      <td>417</td>\n",
       "      <td>610062</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>蒜蓉生蚝</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>49</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2016-08-01 11:05:36</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>caipu/104001.jpg</td>\n",
       "      <td>1442</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2958</td>\n",
       "      <td>417</td>\n",
       "      <td>609957</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>蒙古烤羊腿\\r\\n\\r\\n\\r\\n</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>48</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2016-08-01 11:07:07</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>caipu/202003.jpg</td>\n",
       "      <td>1442</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2961</td>\n",
       "      <td>417</td>\n",
       "      <td>609950</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>大蒜苋菜</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>30</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2016-08-01 11:07:40</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>caipu/303001.jpg</td>\n",
       "      <td>1442</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2966</td>\n",
       "      <td>417</td>\n",
       "      <td>610038</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>芝麻烤紫菜</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>25</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2016-08-01 11:11:11</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>caipu/105002.jpg</td>\n",
       "      <td>1442</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2968</td>\n",
       "      <td>417</td>\n",
       "      <td>610003</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>蒜香包</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>13</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2016-08-01 11:11:30</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>caipu/503002.jpg</td>\n",
       "      <td>1442</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2774</th>\n",
       "      <td>6750</td>\n",
       "      <td>774</td>\n",
       "      <td>610011</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>白饭/大碗</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>10</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2016-08-10 21:56:24</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>caipu/601005.jpg</td>\n",
       "      <td>1138</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2775</th>\n",
       "      <td>6742</td>\n",
       "      <td>774</td>\n",
       "      <td>609996</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>牛尾汤</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>40</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2016-08-10 21:56:48</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>caipu/201006.jpg</td>\n",
       "      <td>1138</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2776</th>\n",
       "      <td>6756</td>\n",
       "      <td>774</td>\n",
       "      <td>609949</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>意文柠檬汁</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>13</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2016-08-10 22:01:52</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>caipu/404005.jpg</td>\n",
       "      <td>1138</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2777</th>\n",
       "      <td>6763</td>\n",
       "      <td>774</td>\n",
       "      <td>610014</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>金玉良缘</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>30</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2016-08-10 22:03:58</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>caipu/302003.jpg</td>\n",
       "      <td>1138</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2778</th>\n",
       "      <td>6764</td>\n",
       "      <td>774</td>\n",
       "      <td>610017</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>酸辣藕丁</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>33</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2016-08-10 22:04:30</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>caipu/302006.jpg</td>\n",
       "      <td>1138</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>2779 rows × 19 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      detail_id  order_id  dishes_id  logicprn_name  parent_class_name  \\\n",
       "0          2956       417     610062            NaN                NaN   \n",
       "1          2958       417     609957            NaN                NaN   \n",
       "2          2961       417     609950            NaN                NaN   \n",
       "3          2966       417     610038            NaN                NaN   \n",
       "4          2968       417     610003            NaN                NaN   \n",
       "...         ...       ...        ...            ...                ...   \n",
       "2774       6750       774     610011            NaN                NaN   \n",
       "2775       6742       774     609996            NaN                NaN   \n",
       "2776       6756       774     609949            NaN                NaN   \n",
       "2777       6763       774     610014            NaN                NaN   \n",
       "2778       6764       774     610017            NaN                NaN   \n",
       "\n",
       "            dishes_name  itemis_add  counts  amounts  cost  \\\n",
       "0                  蒜蓉生蚝           0       1       49   NaN   \n",
       "1     蒙古烤羊腿\\r\\n\\r\\n\\r\\n           0       1       48   NaN   \n",
       "2                  大蒜苋菜           0       1       30   NaN   \n",
       "3                 芝麻烤紫菜           0       1       25   NaN   \n",
       "4                   蒜香包           0       1       13   NaN   \n",
       "...                 ...         ...     ...      ...   ...   \n",
       "2774              白饭/大碗           0       1       10   NaN   \n",
       "2775                牛尾汤           0       1       40   NaN   \n",
       "2776             意文柠檬汁            0       1       13   NaN   \n",
       "2777               金玉良缘           0       1       30   NaN   \n",
       "2778               酸辣藕丁           0       1       33   NaN   \n",
       "\n",
       "        place_order_time  discount_amt  discount_reason  kick_back  \\\n",
       "0    2016-08-01 11:05:36           NaN              NaN        NaN   \n",
       "1    2016-08-01 11:07:07           NaN              NaN        NaN   \n",
       "2    2016-08-01 11:07:40           NaN              NaN        NaN   \n",
       "3    2016-08-01 11:11:11           NaN              NaN        NaN   \n",
       "4    2016-08-01 11:11:30           NaN              NaN        NaN   \n",
       "...                  ...           ...              ...        ...   \n",
       "2774 2016-08-10 21:56:24           NaN              NaN        NaN   \n",
       "2775 2016-08-10 21:56:48           NaN              NaN        NaN   \n",
       "2776 2016-08-10 22:01:52           NaN              NaN        NaN   \n",
       "2777 2016-08-10 22:03:58           NaN              NaN        NaN   \n",
       "2778 2016-08-10 22:04:30           NaN              NaN        NaN   \n",
       "\n",
       "      add_inprice  add_info  bar_code      picture_file  emp_id  \n",
       "0               0       NaN       NaN  caipu/104001.jpg    1442  \n",
       "1               0       NaN       NaN  caipu/202003.jpg    1442  \n",
       "2               0       NaN       NaN  caipu/303001.jpg    1442  \n",
       "3               0       NaN       NaN  caipu/105002.jpg    1442  \n",
       "4               0       NaN       NaN  caipu/503002.jpg    1442  \n",
       "...           ...       ...       ...               ...     ...  \n",
       "2774            0       NaN       NaN  caipu/601005.jpg    1138  \n",
       "2775            0       NaN       NaN  caipu/201006.jpg    1138  \n",
       "2776            0       NaN       NaN  caipu/404005.jpg    1138  \n",
       "2777            0       NaN       NaN  caipu/302003.jpg    1138  \n",
       "2778            0       NaN       NaN  caipu/302006.jpg    1138  \n",
       "\n",
       "[2779 rows x 19 columns]"
      ]
     },
     "execution_count": 46,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.concat([df1,df2],axis=1,join='outer')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2774</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2775</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2776</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2777</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2778</th>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5558 rows × 0 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "Empty DataFrame\n",
       "Columns: []\n",
       "Index: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, ...]\n",
       "\n",
       "[5558 rows x 0 columns]"
      ]
     },
     "execution_count": 47,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.concat([df1,df2],axis=0,join='inner')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>detail_id</th>\n",
       "      <th>order_id</th>\n",
       "      <th>dishes_id</th>\n",
       "      <th>logicprn_name</th>\n",
       "      <th>parent_class_name</th>\n",
       "      <th>dishes_name</th>\n",
       "      <th>itemis_add</th>\n",
       "      <th>counts</th>\n",
       "      <th>amounts</th>\n",
       "      <th>cost</th>\n",
       "      <th>place_order_time</th>\n",
       "      <th>discount_amt</th>\n",
       "      <th>discount_reason</th>\n",
       "      <th>kick_back</th>\n",
       "      <th>add_inprice</th>\n",
       "      <th>add_info</th>\n",
       "      <th>bar_code</th>\n",
       "      <th>picture_file</th>\n",
       "      <th>emp_id</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2956.0</td>\n",
       "      <td>417.0</td>\n",
       "      <td>610062.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>蒜蓉生蚝</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>49.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaT</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2958.0</td>\n",
       "      <td>417.0</td>\n",
       "      <td>609957.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>蒙古烤羊腿\\r\\n\\r\\n\\r\\n</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>48.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaT</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2961.0</td>\n",
       "      <td>417.0</td>\n",
       "      <td>609950.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>大蒜苋菜</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>30.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaT</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2966.0</td>\n",
       "      <td>417.0</td>\n",
       "      <td>610038.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>芝麻烤紫菜</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>25.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaT</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>2968.0</td>\n",
       "      <td>417.0</td>\n",
       "      <td>610003.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>蒜香包</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>13.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaT</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2774</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2016-08-10 21:56:24</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>caipu/601005.jpg</td>\n",
       "      <td>1138.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2775</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2016-08-10 21:56:48</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>caipu/201006.jpg</td>\n",
       "      <td>1138.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2776</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2016-08-10 22:01:52</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>caipu/404005.jpg</td>\n",
       "      <td>1138.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2777</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2016-08-10 22:03:58</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>caipu/302003.jpg</td>\n",
       "      <td>1138.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2778</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2016-08-10 22:04:30</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>0.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>caipu/302006.jpg</td>\n",
       "      <td>1138.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5558 rows × 19 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      detail_id  order_id  dishes_id  logicprn_name  parent_class_name  \\\n",
       "0        2956.0     417.0   610062.0            NaN                NaN   \n",
       "1        2958.0     417.0   609957.0            NaN                NaN   \n",
       "2        2961.0     417.0   609950.0            NaN                NaN   \n",
       "3        2966.0     417.0   610038.0            NaN                NaN   \n",
       "4        2968.0     417.0   610003.0            NaN                NaN   \n",
       "...         ...       ...        ...            ...                ...   \n",
       "2774        NaN       NaN        NaN            NaN                NaN   \n",
       "2775        NaN       NaN        NaN            NaN                NaN   \n",
       "2776        NaN       NaN        NaN            NaN                NaN   \n",
       "2777        NaN       NaN        NaN            NaN                NaN   \n",
       "2778        NaN       NaN        NaN            NaN                NaN   \n",
       "\n",
       "            dishes_name  itemis_add  counts  amounts  cost  \\\n",
       "0                  蒜蓉生蚝         0.0     1.0     49.0   NaN   \n",
       "1     蒙古烤羊腿\\r\\n\\r\\n\\r\\n         0.0     1.0     48.0   NaN   \n",
       "2                  大蒜苋菜         0.0     1.0     30.0   NaN   \n",
       "3                 芝麻烤紫菜         0.0     1.0     25.0   NaN   \n",
       "4                   蒜香包         0.0     1.0     13.0   NaN   \n",
       "...                 ...         ...     ...      ...   ...   \n",
       "2774                NaN         NaN     NaN      NaN   NaN   \n",
       "2775                NaN         NaN     NaN      NaN   NaN   \n",
       "2776                NaN         NaN     NaN      NaN   NaN   \n",
       "2777                NaN         NaN     NaN      NaN   NaN   \n",
       "2778                NaN         NaN     NaN      NaN   NaN   \n",
       "\n",
       "        place_order_time  discount_amt  discount_reason  kick_back  \\\n",
       "0                    NaT           NaN              NaN        NaN   \n",
       "1                    NaT           NaN              NaN        NaN   \n",
       "2                    NaT           NaN              NaN        NaN   \n",
       "3                    NaT           NaN              NaN        NaN   \n",
       "4                    NaT           NaN              NaN        NaN   \n",
       "...                  ...           ...              ...        ...   \n",
       "2774 2016-08-10 21:56:24           NaN              NaN        NaN   \n",
       "2775 2016-08-10 21:56:48           NaN              NaN        NaN   \n",
       "2776 2016-08-10 22:01:52           NaN              NaN        NaN   \n",
       "2777 2016-08-10 22:03:58           NaN              NaN        NaN   \n",
       "2778 2016-08-10 22:04:30           NaN              NaN        NaN   \n",
       "\n",
       "      add_inprice  add_info  bar_code      picture_file  emp_id  \n",
       "0             NaN       NaN       NaN               NaN     NaN  \n",
       "1             NaN       NaN       NaN               NaN     NaN  \n",
       "2             NaN       NaN       NaN               NaN     NaN  \n",
       "3             NaN       NaN       NaN               NaN     NaN  \n",
       "4             NaN       NaN       NaN               NaN     NaN  \n",
       "...           ...       ...       ...               ...     ...  \n",
       "2774          0.0       NaN       NaN  caipu/601005.jpg  1138.0  \n",
       "2775          0.0       NaN       NaN  caipu/201006.jpg  1138.0  \n",
       "2776          0.0       NaN       NaN  caipu/404005.jpg  1138.0  \n",
       "2777          0.0       NaN       NaN  caipu/302003.jpg  1138.0  \n",
       "2778          0.0       NaN       NaN  caipu/302006.jpg  1138.0  \n",
       "\n",
       "[5558 rows x 19 columns]"
      ]
     },
     "execution_count": 48,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.concat([df1,df2],axis=0,join='outer')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(5558, 19)"
      ]
     },
     "execution_count": 51,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.concat([df1,df2],axis=0,join='outer').shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "pandas.core.frame.DataFrame"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "type(df1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "ename": "TypeError",
     "evalue": "data type not understood",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mTypeError\u001b[0m                                 Traceback (most recent call last)",
      "\u001b[1;32m<ipython-input-8-7c05f78c4efc>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[1;32m----> 1\u001b[1;33m \u001b[0mnp\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mdtype\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mdf1\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m",
      "\u001b[1;31mTypeError\u001b[0m: data type not understood"
     ]
    }
   ],
   "source": [
    "np.dtype(df1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
